#include <linux/sched.h>
#include <linux/sched/task.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/pid.h>
#include <linux/err.h>

static int idle_dummy(void *dummy)
{
    /* This function is never called */
    return 0;
}

__init struct task_struct *fork_idle(int cpu)
{
    struct task_struct *task;
    struct kernel_clone_args args = {
        .flags = CLONE_VM,
        .fn = &idle_dummy,
        .fn_arg = NULL,
        .kthread = 1,
        .idle = 1,
    };

    task = copy_process(NULL, 0, cpu, &args);
    if (!IS_ERR(task))
    {
        init_idle(task, cpu);
    }

    return task;
}
